Note:
The PC software "Silicon Labs Serial Bootloader Data Source" source code (Visual C#) 
and installer (setup.exe) are included as part of AN533SW.zip. This software is required for 
this bootloader framework. 
This can be downloaded from: http://www.silabs.com/products/mcu/Pages/ApplicationNotes.aspx

1.	LIN Bootloader  Demonstration Steps

1.1.	Items needed for the demo

*	This demo uses the C8051F500 Target Board as the demonstration platform. 
*	Wall power supply to power the board.
*	A USB Debug Adapter and the Silicon Labs IDE or the MCU Production Programmer utility for initial programming of the bootloader firmware.
*	USB cable to connect the CP2102 USB-to-UART Bridge on the C8051F500 Target Board to the PC.
*	A short wire to connect two port pins together.

1.2.	Labels used in this document

*	Master MCU  The C8051F500 MCU on Side A of the C8051F500 Target Board.
*	Target MCU  The C8051F502 MCU on Side B of the C8051F500 Target Board.
*	Data Source  The Serial Bootloader Data Source PC Application.
*	Target Bootloader Firmware  The code that is programmed once to the target MCU. This is done via C2 programming using the Silicon Labs IDE and a USB Debug Adapter.
*	Application Firmware  The code that on the target MCU to perform end application. This firmware is initially delivered to the target MCU via LIN, and can be updated via LIN.

1.3.	Hardware Setup

1.	Connect wall power to the C8051F500 Target Board via the DC power jack (P4).
2.	For programming, connect the USB Debug Adapter to either DEBUG A or DEBUG B connectors as necessary.

3.	Ensure that the following shorting blocks are in place on the board:
a.	Header J17: UART_RX and UART_TX
b.	Header J19: Switch and LED
c.	Header J11: Switch and LED

	NOTE: Some deficiencies have been discovered with the LIN transceiver circuitry on the 'F500 target board rev 002. This board can be identified by the following marking on the bottom of the board: "SA-TB69PCB-002". As a workaround, we will circumvent the transceiver circuitry and connect the LIN TX/RX pins of both MCUs together with all of the pins configured for open-drain output. 

4.	Ensure that the following shorting blocks are NOT populated on the board:
a.	Header J17: LIN_RX and LIN_TX
b.	Header J26: LIN_RX and LIN_TX

5.	We will use shorting blocks to connect the LIN_TX and LIN_RX for each MCU:
a.	Header J2: Bridge P1.0 with P1.1
b. 	Header J28: Bridge P1.0 with P1.1

6.	As the last step, we will connect the LIN pins of both MCUs together:
a.	Use a wire to connect P1.0 of side "A" MCU with P1.0 of side "B" MCU.

 
1.4.	Software and Firmware Setup

1.	Extract all files from the zip package to a folder on a Windows PC.
2.	Use the Silicon Labs IDE to download the Target MCU Bootloader Firmware to the Target MCU (Side B). This firmware will be resident on the Target MCU, and will then be able to receive the application firmware over LIN. This firmware is pre-built, with the hex file available here: ...\TargetBootloader\F50x_LIN0_TargetBL.hex
Note: In the IDE, connect to the MCU and use the Debug > Download Object File option to download the hex file to the MCU.
3.	Use the Silicon Labs IDE to download the Master MCU Bootloader Firmware to the Master MCU (Side A). This firmware will issue commands to the data source (PC) and the target MCU to program the firmware. This firmware is pre-built, with the hex file available here: "...\MasterProgrammer\F50x_LIN0_Master.hex"
4.	If you do not have Virtual COM Port (VCP) device drivers for the CP2102 USB-to-UART bridge installed on your PC, do so now by downloading the driver from here: http://www.silabs.com/products/mcu/Pages/USBtoUARTBridgeVCPDrivers.aspx
5.	Now, disconnect the USB Debug Adapter from the Target Board and connect the USB cable between the target board and the PC.
6.	A Virtual COM Port will be now available on your PC. Use Windows Device Manager to check the COM port number and note it down (COM3, COM4 etc).
7.	Launch the Serial Bootloader Data Source PC application setup from here: \Source_BL_SW\Release\setup.exe
8.	Once the application is installed, it will be automatically launched. A start menu shortcut will also be available for future use.

 
1.5.	Demonstration Steps

1.	The C8051F500 Target Board should be now loaded with the Master Bootloader Firmware on Side A and Target Bootloader Firmware on Side B. The PC Application should be installed on the PC. Power the target board and connect the USB cable for the Virtual COM Port.
2.	Launch the Serial Bootloader Data Source PC application by going to Start Menu > Silicon Laboratories > Silicon Labs Serial Bootloader Data Source.
3.	Click the Select Hex File button and choose the Version 1.0 of the Target Application Firmware available here: ...\TargetApp_Examples\F50x_LIN0_Slave_Blinky_Ver1_0\F50x_LIN_Slave_Blinky.hex"
4.	The hex file is processed and the extracted application information is shown in the table view of the PC application.
5.	Select the COM port number (see section 1.4, step 6) of the Target Boards Virtual COM Port from the drop-down box. The other port settings are pre-selected and need not be changed.
6.	Click the Open COM Port button.
7.	On the Target Board, press the P1.4_A push-button switch on Side A to start the bootloading process. The bootload process cannot be initiated from the PC application because it is acting as a slave data source.
8.	Follow the prompts shown by the PC application to complete the bootload process. At the end of this process, the application firmware will be running on the Target MCU and you should see the LED P1.3_B on Side B blinking at a moderate rate. 
9.	Now, to demonstrate firmware update to a new version, click the Select Hex File button and choose the Version 1.1 of the Target Application Firmware available here: ...\TargetApp_Examples\F50x_LIN0_Slave_Blinky_Ver1_1\F50x_LIN_Slave_Blinky.hex"
10.	Press the P1.4_A push-button switch on Side A to start the bootloading process. 
Follow the prompts shown by the PC application to complete the bootload process. At the end of this process, the new version of the application firmware will be running on the Target MCU and you should see the LED P1.3_B on Side B blinking at a much faster rate. This is the update in the Version 1.1 of the application firmware (for demonstration purposes). 
11. 	With each version of the LIN slave example firmware in place, you can also test standard LIN communication between the Master and the Slave. For this demo, the Master MCU should execute its "LIN Master Example" firmware instead of the Master Programmer firmware. To put the Master in this mode, press and hold the "P1.4_A" switch on Side "A" and then press and release the "RESET_A" switch. Now, you can press the "P1.4_A" or "P1.4_B" switches to send messages between the Master and the Slave. To put the Master MCU back in the programming mode, just press the "RESET_A" switch without pressing the "P1.4_A" switch.
